<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<h:outputStylesheet name="default.css" library="css" />
</h:head>
<body>
	<h:form id="tab">
		<p:dataTable id="val" var="p" value="#{almoxMB.values}">
			<p:column headerText="ID" style="width:30px">
				<h:outputText value="#{p.id}" />
			</p:column>
			<p:column headerText="Pedido" style="width:300px">
				<h:outputText value="#{p.description}" />
			</p:column>
			<p:column headerText="Data/Hora">
				<h:outputText value="#{p.date.time}">
					<f:convertDateTime pattern="dd/MM/yyyy - HH:mm:ss" />
				</h:outputText>
			</p:column>
			<p:column headerText="Prioridade">
				<h:outputText value="#{almoxMB.getPrioridadeTexto(p.priority)}" />
			</p:column>
			<p:column headerText="#">
				<p:commandLink actionListener="#{almoxMB.enviar(p)}"
					oncomplete="carDialog.show()" update=":carDlg">
					<h:outputText value="Enviar" />
				</p:commandLink>
			</p:column>
		</p:dataTable>
	</h:form>


	<p:dialog header="Pedido" widgetVar="carDialog" resizable="false"
		id="carDlg" showEffect="fade" hideEffect="explode">
		<h:form id="dialog_form">

			<h:panelGrid id="display" columns="2" cellpadding="4"
				style="margin:0 auto;">

				<h:outputText value="Localização:" />
				<h:outputText value="#{almoxMB.selectedOrder.deliveryPlace.local}"
					style="font-weight:bold" />

				<h:outputText value="Data/Hora:" />
				<h:outputText value="#{almoxMB.selectedOrder.date.time}"
					style="font-weight:bold">
					<f:convertDateTime pattern="dd/MM/yyyy - HH:mm:ss" />
				</h:outputText>


				<h:outputText value="Prioridade:" />
				<h:outputText value="#{almoxMB.prioridadeTexto}"
					style="font-weight:bold" />

				<h:outputText value="Status:" />
				<h:outputText value="#{almoxMB.statusNome}" style="font-weight:bold" />

				<h:outputText value="Descrição do Pedido:" />
				<h:outputText styleClass="quebra"
					value="#{almoxMB.selectedOrder.description}"
					style="font-weight:bold;" />

				<h:outputText value="Carro:" />
				<p:inputText type="number" value="#{almoxMB.selectedOrder.car}" />

				<h:outputText />
				<p:commandButton value="Enviar"
					actionListener="#{almoxMB.atualizar}" update="@form :tab:val"
					oncomplete="carDialog.hide()" />

			</h:panelGrid>

		</h:form>
	</p:dialog>

</body>
</html>